package com.leesche.zcsp.node.web.vo.v2.enums;

/**
 * Created by kaider on 2016/12/3.
 */
public enum AccountEnum {
    TODAY(1,"todayView"),//今日
    WEEK(2,"weekView"),//本周
    MONTH(3,"monthView"),//本月
    YESTERDAY(4,"yesterdayView"),//昨天
    LAST_WEEK(5,"lastWeekView"),//上周
    LAST_MONTH(6,"lastMonthView"),//上月
    FREQUENCY(7,"frequencyView"),//按次数
    LEDGER(8,"ledgerView"),//总账
    SEARCH_TIME(9,"searchTimeView"),//时间条件查询
    SEARCH(10,"searchView");

    private Integer code;
    private String message;

    AccountEnum(int code, String message)
    {
        this.code = code;
        this.message = message;
    }

    public Integer getCode()
    {
        return code;
    }

    public String getMessage()
    {
        return message;
    }

    static public AccountEnum parse(Integer code)
    {
        for (AccountEnum each : AccountEnum.values())
        {
            if (each.getCode().equals(code))
            {
                return each;
            }
        }
        return null;
    }

    static public AccountEnum parse(String message)
    {
        for(AccountEnum each : AccountEnum.values())
        {
            if (each.getMessage().equals(message))
            {
                return each;
            }
        }
        return null;
    }


    public static void main(String[] args) {
        System.out.println(parse(1));
        System.out.println(parse("yesterdayView"));
        /*System.out.println(parseToCode("yesterdayView"));
        System.out.println(parseToMessage(5));*/
    }
}
